<?php

class Cron_IndexController extends Common_Controller_Front {

    
    
    public function init() {
        $this->_helper->layout->disableLayout(true);
        $this->_helper->viewRenderer->setNoRender(true);
    }

    public function indexAction() {

        $tasks = new Application_Model_Tasks();
        $all = $tasks->fetchAll('status=0', 'id asc', 5);
        $nm = '';
        foreach($all as $key => $item){
            
            $nm = Common_Cron_Executor::_CEXEC_PREFIX.ucfirst($item->class);
            
            try{
                $exec = new $nm($this);
                
                if(method_exists($exec, 'exec')){
                    $exec->exec($item);
                }
                
            }catch(Exception $e){
                var_dump($e);exit;
            }
            
        }
        
        
    }

}

